/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tv.pool.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ctrosch
 */
@Entity
@Table(name = "USR_POOLTB")
@IdClass(BasesCondicionesPK.class)
public class BasesCondiciones implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "USR_POOLTB_POOLTH_CODIGO")
    private String codigo;
    @Id
    @Column(name = "USR_POOLTB_NROITM")
    private double nroitm;

    @Lob
    @Column(name = "USR_POOLTB_DESCRP", length = 2147483647)
    private String descripcion;


    @JoinColumn(name = "USR_POOLTB_POOLTH_CODIGO", referencedColumnName = "USR_POOLTH_CODIGO", nullable = false, insertable=false, updatable=false)
    @ManyToOne
    private PoolTipo poolTipo;

    @Column(name = "USR_PO_FECALT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecalt;
    @Column(name = "USR_PO_FECMOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmod;
    @Column(name = "USR_PO_USERID")
    private String userid;
    @Column(name = "USR_PO_ULTOPR")
    private String ultopr;
    @Column(name = "USR_PO_DEBAJA")
    private String debaja;
    @Column(name = "USR_PO_OALIAS")
    private String oalias;
    
    public BasesCondiciones() {
        
        fecalt = new Date();
        fecmod = new Date();
        userid = "ADMIN";
        ultopr = "A";
        debaja = "N";
        oalias = "USR_POOLTB";
    }

    public BasesCondiciones(String codigo, double nroitm) {
        this.codigo = codigo;
        this.nroitm = nroitm;
        
        fecalt = new Date();
        fecmod = new Date();
        userid = "ADMIN";
        ultopr = "A";
        debaja = "N";
        oalias = "USR_POOLTB";

    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getDebaja() {
        return debaja;
    }

    public void setDebaja(String debaja) {
        this.debaja = debaja;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Date getFecalt() {
        return fecalt;
    }

    public void setFecalt(Date fecalt) {
        this.fecalt = fecalt;
    }

    public Date getFecmod() {
        return fecmod;
    }

    public void setFecmod(Date fecmod) {
        this.fecmod = fecmod;
    }

    public double getNroitm() {
        return nroitm;
    }

    public void setNroitm(double nroitm) {
        this.nroitm = nroitm;
    }

    public String getOalias() {
        return oalias;
    }

    public void setOalias(String oalias) {
        this.oalias = oalias;
    }

    public String getUltopr() {
        return ultopr;
    }

    public void setUltopr(String ultopr) {
        this.ultopr = ultopr;
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public PoolTipo getPoolTipo() {
        return poolTipo;
    }

    public void setPoolTipo(PoolTipo poolTipo) {
        this.poolTipo = poolTipo;
    }


    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final BasesCondiciones other = (BasesCondiciones) obj;
        if ((this.codigo == null) ? (other.codigo != null) : !this.codigo.equals(other.codigo)) {
            return false;
        }
        if (Double.doubleToLongBits(this.nroitm) != Double.doubleToLongBits(other.nroitm)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.codigo != null ? this.codigo.hashCode() : 0);
        hash = 23 * hash + (int) (Double.doubleToLongBits(this.nroitm) ^ (Double.doubleToLongBits(this.nroitm) >>> 32));
        return hash;
    }

    @Override
    public String toString() {
        return "BasesCondicones{" + "codigo=" + codigo + "nroitm=" + nroitm + '}';
    }
    
}
